// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov  Date: 2009-10-26 21:57:27


// Source File Name:   SourceFile.java

package com.vhly.classfile;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

// Referenced classes of package com.vhly.classfile:
//            Attribute

public class SourceFile
        implements Attribute {

    private int source_index;
    private int name_index;
    private int data_len;

    public SourceFile(int attribNameIndex, int sourceIndex) {
        source_index = sourceIndex;
        name_index = attribNameIndex;
        data_len = 2;
    }

    public SourceFile() {
        source_index = 0;
        name_index = 0;
        data_len = 2;
    }

    public int getSourceIndex() {
        return source_index;
    }

    public void setSourceIndex(int i) {
        source_index = i;
    }

    public void setNameIndex(int i) {
        name_index = i;
    }

    public int getNameIndex() {
        return name_index;
    }

    public void setDataLen(int i) {
        data_len = i;
    }

    public int getDataLen() {
        return data_len;
    }

    public void read(DataInputStream datainputstream, boolean flag)
            throws IOException {
        if (flag)
            name_index = datainputstream.readUnsignedShort();
        data_len = datainputstream.readInt();
        source_index = datainputstream.readUnsignedShort();
    }

    public void write(DataOutputStream dout)
            throws IOException {
        dout.writeShort(name_index);
        dout.writeInt(data_len);
        dout.writeShort(source_index);
    }

    public int getType() {
        return 1;
    }
}